

// 传入一个对象对象作为参数 {user, pwd, phone, email}
function register(params) {
    return new Promise(function (resolve, reject) {
        $.ajax({
            type: "post",
            url: "../php/register.php",
            data: { ...params },
            dataType: "json",
            success: function (data) { //形式参数(接口返回的响应数据 )
                resolve(data);
            }
        })
    })
}


function isExistUser(params) {   // {user}
    return new Promise(function (resolve, reject) {
        $.ajax({
            // type:"get",
            url: "../php/isExistUser.php",
            data: { ...params },
            // async:true,
            dataType: "json",
            success: function (data) {
                resolve(data)
            }
        })
    })
}
function login(params) {   // {user,pwd}
    return new Promise(function (resolve, reject) {
        $.ajax({
            type: "post",
            url: "../php/login.php",
            data: { ...params },
            dataType: "json",
            success: data => {
                resolve(data)
            }
        })
    })
}